﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using KPIS.GERP.GFMS.APP.App_UI.Commons;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.BLL;
using KPIS.GERP.GFMS.MODEL;
namespace KPIS.GERP.GFMS.APP.App_UI.UserControls
{
    public partial class BGM_ProjectOperationExpense : System.Web.UI.UserControl
    {
        IBLL_BGM_ProjectOperationExpense opexp = new B_BGM_ProjectOperationExpense();

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        public void LoadUserControl(string strSeq)
        {
            lblBgmProjOperSeq.Text = strSeq;
            LoadData();
        }

        public Label Get_lblBgmProjOperSeq()
        {
            return lblBgmProjOperSeq;
        }

        protected void LoadData()
        {
            RepeaterBgmSource.DataSource = opexp.GetGroupBgmSource(lblBgmProjOperSeq.Text);
            RepeaterBgmSource.DataBind();

            for (int i = 0; i < RepeaterBgmSource.Items.Count; i++)
            {
                RepeaterItem item = RepeaterBgmSource.Items[i];
                Label lblBgmSourceSeq = (Label)item.FindControl("lblBgmSourceSeq");
                Repeater RepeaterBgmExpGrp = (Repeater)item.FindControl("RepeaterBgmExpGrp");

                RepeaterBgmExpGrp.DataSource = opexp.GetGroupBgmExpGrp(lblBgmProjOperSeq.Text, lblBgmSourceSeq.Text);
                RepeaterBgmExpGrp.DataBind();

                for (int j = 0; j < RepeaterBgmExpGrp.Items.Count; j++)
                {
                    RepeaterItem item2 = RepeaterBgmExpGrp.Items[j];
                    Label lblBgmExpGrpSeq = (Label)item2.FindControl("lblBgmExpGrpSeq");
                    Repeater RepeaterBgmExp = (Repeater)item2.FindControl("RepeaterBgmExp");

                    RepeaterBgmExp.DataSource = opexp.GetGroupBgmExp(lblBgmProjOperSeq.Text
                        , lblBgmSourceSeq.Text, lblBgmExpGrpSeq.Text);
                    RepeaterBgmExp.DataBind();
                }
            }
        }
    }
}